#define _GNU_SOURCE
#include "app_pool.h"
#include <unistd.h>
#include "log/log.h"

char* mesg[] = {
    "My Task one",
    "My Task two",
    "My Task three",
    "My Task four",
    "My Task five",
    "My Task six",
    "My Task seven",
    "My Task eight"
};

int task_func(void *arg){
    log_debug("task_func (%ld): %s", gettid(), (char *)arg);

    return 0;
}

int main(int argc, char const *argv[])
{
    // 初始化线程池
    app_pool_init(5);

    // 添加任务
    for (int i = 0; i < 8; i++)
    {
        app_pool_registerTask(task_func, mesg[i]);
    }
    
    sleep(1);

    // 销毁线程池
    app_pool_close();

    return 0;
}
